/*
   Copyright (c) [Year] [name of copyright holder]
   [Software Name] is licensed under Mulan PSL v2.
   You can use this software according to the terms and conditions of the Mulan PSL v2. 
   You may obtain a copy of Mulan PSL v2 at:
            http://license.coscl.org.cn/MulanPSL2 
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
   See the Mulan PSL v2 for more details.  
*/

// #define MY_ENABLE_DEBUG
#include"jiajia.hpp"

int main(int argc, char ** argv){
    using namespace std;
    using namespace my;
    using namespace jiajia;

    lib::init_func();
    // my::ufile file;
    // file.open("../test/test.jiajia");
    // my::unicode_t u;
    // while(!file.eof()){
    //     file.read(&u, 1);
    //     if(file.gcount() == 1)
    //         std::cout<<my::utf8::UnicodeToStr(u);
    // }
    if(argc != 2){
        std::cout<<"使用方式 ./jiajia jiajia文件的路径"<<std::endl;
        return 0;
    }
    jjcompiler compiler;
    compiler.open(argv[1]);
    compiler.run();
    // while(compiler.nextUnicode() != my::unicode::eof){
    // }
    // compiler.nextWord();
    // std::cout<<compiler<<std::endl;
    // compiler.shi();
    // compiler.genConstant();
  

    // std::cout<<"归约：action = "<<action
    //          <<", _product_size = "<<_product_size[action]
    //          <<", _product_head = "<<WORDSTR(_product_head[action])
    //          <<", action_stack.back() = "<<action_stack.back()
    //          <<", _goto = "<<_goto[action_stack.back()][_product_head[action]-begin_of_item]<<std::endl;

    return 0;
}
